home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bob_espo.swf / scripts / __Packages / MiniGames / JFS / JFSJellyFish.as < prev    next >
Encoding:
Text File  |  2013-04-24  |  1.8 KB  |  75 lines

  1. class MiniGames.JFS.JFSJellyFish extends State
  2. {
  3.    var oParent;
  4.    var mcRef;
  5.    static var sSTATE_IDLE = "Idle";
  6.    static var sSTATE_REMOVING = "Removing";
  7.    static var sSTATE_REMOVED = "Removed";
  8.    static var sSTATE_REACT = "React";
  9.    function JFSJellyFish(_mcRef, _oParent)
  10.    {
  11.       super(_mcRef);
  12.       this.oParent = _oParent;
  13.       this.setState(MiniGames.JFS.JFSJellyFish.sSTATE_IDLE);
  14.       var _loc5_ = Math.round(Math.random() * this.mcRef.mcState._totalframes - 1) + 1;
  15.       this.mcRef.mcState.gotoAndPlay(_loc5_);
  16.       this.mcRef.mcState.mcHeart.gotoAndPlay(_loc5_);
  17.       this.giveEvent();
  18.    }
  19.    function leaveBus()
  20.    {
  21.       this.setState(MiniGames.JFS.JFSJellyFish.sSTATE_REMOVING);
  22.       Controller.getRef().getSounds().playSound("JellyFish_Leave",Controller.nSFX_VOLUME,1);
  23.    }
  24.    function giveEvent()
  25.    {
  26.       this.mcRef.onPress = Delegate.create(this,this.register);
  27.    }
  28.    function removeEvent()
  29.    {
  30.       delete this.mcRef.onPress;
  31.       this.mcRef.onPress = null;
  32.    }
  33.    function react()
  34.    {
  35.       this.setState(MiniGames.JFS.JFSJellyFish.sSTATE_REACT);
  36.    }
  37.    function doPause()
  38.    {
  39.       super.doPause();
  40.       for(var i in this.mcRef.mcState)
  41.       {
  42.          this.mcRef.mcState[i].stop();
  43.       }
  44.    }
  45.    function doUnPause()
  46.    {
  47.       super.doUnPause();
  48.       for(var i in this.mcRef.mcState)
  49.       {
  50.          this.mcRef.mcState[i].play();
  51.       }
  52.    }
  53.    function register()
  54.    {
  55.       this.oParent.takeHook(this);
  56.    }
  57.    function Idle()
  58.    {
  59.    }
  60.    function Removing()
  61.    {
  62.       if(this.stateFinished())
  63.       {
  64.          this.setState(MiniGames.JFS.JFSJellyFish.sSTATE_REMOVED);
  65.          this.oParent.decreaseJellyFishCount();
  66.       }
  67.    }
  68.    function React()
  69.    {
  70.    }
  71.    function Removed()
  72.    {
  73.    }
  74. }
  75.